package com.pro.service.imple;

import com.pro.mapper.JsApplicantMapper;
import com.pro.pojo.JsAuditLog;
import com.pro.pojo.JsRole;
import com.pro.service.JsApplicantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName:JsApplicantServiceImple
 * Package:com.pro.service.imple
 * Description:
 *
 * @Date:2022/1/26 21:01
 * @Author: XJR
 */
@Service
public class JsApplicantServiceImple implements JsApplicantService {

    @Autowired
    private JsApplicantMapper mapper;

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/26
     * @Content:查看创作者申请列表
     */
    public  List<JsRole> selectJsApplicant(String roleName,String applyDate,String result,Integer limit,Integer page){
        page = (page-1)*limit;
        List<JsRole> jsRoles = mapper.selectJsApplicant(roleName, applyDate,result, limit, page);
        return jsRoles;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/26
     * @Content:计算创作者总数
     */
    public Integer countJsApplicant(String roleName,String applyDate,String result){
        Integer integer = mapper.countJsApplicant(roleName, applyDate,result);
        return integer;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/28
     * @Content:审核申请
     */
    public Boolean aditApplicantStatus(JsRole jsRole){
        Boolean updaBoolean = mapper.aditApplicantStatus(jsRole);
        return updaBoolean;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/30
     * @Content:增加申请审核日志
     */

    public Boolean addJsAuditLog(JsAuditLog jsAuditLog){
        Boolean addBoolean = mapper.addJsAuditLog(jsAuditLog);
        return addBoolean;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/28
     * @Content:通过id查看详情
     */
    public JsRole selectApplicantById(Integer id){
        JsRole jsRole = mapper.selectApplicantById(id);
        return jsRole;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/30
     * @Content:查看审核日志
     */
    public List<JsRole> selectJsAuditLog(String roleName,String createDate,String type,Integer limit,Integer page){
        page = (page-1)*limit;
        List<JsRole> jsRoles = mapper.selectJsAuditLog(roleName, createDate, type, limit, page);
        return jsRoles;
    };

    /**
     * @Description:
     * @Author: XJR
     * @Date: 2022/1/30
     * @Content:查看审核日志数量
     */
    public Integer countJsAuditLog(String roleName,String createDate,String type){
        Integer count = mapper.countJsAuditLog(roleName, createDate, type);
        return count;
    };
}
